// 策略配置相关接口

import services, { servicesSmp } from '../createServices';

// 渠道管理
export const application = {
  add: (params) => services.post('/app/create', { params, isLoading: true }),
  update: (params) => services.post('/app/edit', { params, isLoading: true }),
  delete: (params) => services.post('/app/delete', { params, isLoading: true }),
  list: (params) => services.post('/app/list', { params, isLoading: true }),
  getAppCodeList: (params) => services.post('/app/get-app-list', { params }),
  getAllAppCodeList: (params) => services.post('/app/get-all-app-code-list', { params }),
  getDeptApp: (params) => services.post('/app/get-app-code-list', { params }),
};

// 事件管理
export const event = {
  add: (params) => services.post('/event/create', { params, isLoading: true }),
  update: (params) => services.post('/event/edit', { params, isLoading: true }),
  delete: (params) => services.post('/event/delete', { params, isLoading: true }),
  list: (params) => services.post('/event/list', { params, isLoading: true }),
  getScript: (params) => services.post('/event/get-script', { params, isLoading: true }),
  editScript: (params) => services.post('/event/edit-script', { params, isLoading: true }),
  getEventCodeList: (params) => services.post('/event/get-event-list', { params }),
};

// 策略管理
export const policy = {
  list: (params) => services.post('/strategy-flow/list', { params, isLoading: true }),
  all: (params) => services.post('/strategy-flow/all', { params, isLoading: true }),
  allVersion: (params) => services.post('/strategy-flow/all-version', { params, isLoading: true }),
  relationList: (params) => servicesSmp.post('/component/relatedStrategyList', { params, isLoading: true }),
  add: (params) => services.post('/strategy/create', { params, isLoading: true }),
  update: (params) => services.post('/strategy/edit', { params, isLoading: true }),
  delete: (params) => services.post('/strategy/delete', { params, isLoading: true }),
  queryOne: (params) => services.post('/strategy/detail', { params, isLoading: true }),
  operator: (params) => servicesSmp.post('/sys-operator/list', { params }),
  strategyReleaseAll: (params) => services.post('/strategy-production/all', { params, isLoading: true }),
  strategyAll: (params) => services.post('/strategy-flow/all', { params, isLoading: true }),
  riskTypeList: (params) => services.post('/risk-type/get-code-list', { params, isLoading: true }),
  templatesList: (params) => services.post('/strategy/templates', { params, isLoading: true }), // 模板列表
  templatesCopy: (params) => services.post('/strategy/templates-copy', { params, isLoading: true }), // form添加
  versions: (params) => services.post('/strategy/versions', { params, isLoading: true }), // vierson
  revert: (params) => services.post('/strategy/revert', { params, isLoading: true }), // 还原
  trend: (params) => services.post('/strategy/trend', { params, isLoading: true }), // 趋势图
  trendHitDetail: (params) => services.post('/strategy/trend-hit-detail', { params, isLoading: true }), // 趋势图
  reportCheck: (params) => services.post('/strategy/report-check', { params, isLoading: true }),
  importFile: (params) => services.upload('/strategy/import-file', { params, isLoading: true }),
  // importConfirm: (params) => services.post('/strategy/import-data-confirm', { params, isLoading: true }),
  import: (params) => services.post('/strategy/import', { params, isLoading: true }),
  challengeGroupInfo: (params) => services.post('/strategy/challenger-node-group-info', { params, isLoading: true }),
  challengeCompare: (params) => services.post('/strategy/challenger-risk-trend-compare', { params, isLoading: true }),
  export: (params) => services.post('/strategy-flow/process-report-confirm', { params, isLoading: true }), // 组件导出
  submit: (params) => services.post('/strategy-flow/process-report-check', { params, isLoading: true }), // 导出验证
  exportHandle: (params) => services.post('/strategy-flow/process-report', { params, isLoading: true }), // 数据下载
  uploadFiles: (params) => services.upload('/strategy-flow/import-file', { params }), // 文件导入
  importConfirm: (params) => services.post('/strategy-flow/process-import-confirm', { params, isLoading: true }), // 导入确认
  importHandle: (params) => services.post('/strategy-flow/process-import', { params, isLoading: true }),
  conflictfField: (params) => services.post('/strategy-flow/conflict-check-by-field', { params, isLoading: true }), // 渠道切换再次验证
};

// 组件
export const strategyComponent = {
  list: (params) => servicesSmp.post('/component/page', { params }),
  usablePage: (params) => servicesSmp.post('/component/usablePage', { params }),
  draft: (params) => servicesSmp.post('/component/add', { params }),
  all: (params) => services.post('/strategy-component/all', { params, isLoading: true }),
  add: (params) => servicesSmp.post('/component/addWithVersion', { params }),
  test: (params) => servicesSmp.post('/component/createTest', { params }),
  doTest: (params) => servicesSmp.post('/component/executeTest', { params }),
  update: (params) => servicesSmp.post('/component/updateWithVersion', { params }),
  delete: (params) => servicesSmp.post('/component/delete', { params }),
  queryOne: (params) => servicesSmp.post('/component/detail', { params }), // 版本详情
  revert: (params) => services.post('/strategy-component/revert', { params, isLoading: true }), // 还原
  export: (params) => services.post('/strategy-component/export-chose', { params, isLoading: true }), // 组件导出
  submit: (params) => services.post('/strategy-component/export-check', { params, isLoading: true }), // 导出验证
  exportHandle: (params) => services.post('/strategy-component/export-handle', { params, isLoading: true }), // 数据下载
  uploadFiles: (params) => services.upload('/strategy-component/import-upload', { params }), // 文件导入
  importConfirm: (params) => services.post('/strategy-component/import-confirms', { params, isLoading: true }), // 导入确认
  importHandle: (params) => services.post('/strategy-component/import-handle', { params, isLoading: true }),
  conflictfField: (params) => services.post('/strategy-component/import-conflict-check', { params, isLoading: true }), // 渠道切换再次验证
};

// 组件版本
export const componentVersion = {
  list: (params) => servicesSmp.post('/component/versionPage', { params }),
};

export const strategyUsablePage = {
  list: (params) => servicesSmp.post('/component/usablePage', { params }),
};
// 策略流程
export const strategyFlow = {
  list: (params) => servicesSmp.post('/strategy/page', { params, isLoading: true }),
  addWithVersion: (params) => servicesSmp.post('/strategy/addWithVersion', { params, isLoading: true }),
  add: (params) => servicesSmp.post('/strategy/add', { params, isLoading: true }),
  updateWithVersion: (params) => servicesSmp.post('/strategy/updateWithVersion', { params, isLoading: true }),
  update: (params) => servicesSmp.post('/strategy/update', { params, isLoading: true }),
  delete: (params) => servicesSmp.post('/strategy/delete', { params, isLoading: true }),
  versions: (params) => servicesSmp.post('/strategy/versions', { params, isLoading: true }), // vierson
  queryOne: (params) => servicesSmp.post('/strategy/detail', { params, isLoading: true }), // 版本详情
  revert: (params) => servicesSmp.post('/strategy/revert', { params, isLoading: true }), // 还原
  returns: (params) => servicesSmp.post('/strategy/returnVariableList', { params, isLoading: true }), // 返回变量
  publish: (params) => servicesSmp.post('/strategy/publish', { params, isLoading: true }), // 发布
  preFormList: (params) => servicesSmp.post('/strategy/preFormList', { params, isLoading: true }), // 发布
  versionDetail: (params) => servicesSmp.post('/strategy/versionDetail', { params, isLoading: true }), // 发布
};

// 审核管理
export const audit = {
  list: (params) => services.post('/audit/list', { params, isLoading: true }),
  getDiffContent: (params) => services.post('/audit/get-diff-content', { params, isLoading: true }),
  updateStatus: (params) => services.post('/audit/update-status', { params, isLoading: true }),
  pendingCount: (params) => services.post('/audit/pending-count', { params }),
  auditList: (params) => services.post('/audit/audit-list', { params }),
};

// 产品管理
export const product = {
  add: (params) => services.post('/product/create', { params, isLoading: true }),
  update: (params) => services.post('/product/edit', { params, isLoading: true }),
  delete: (params) => services.post('/product/delete', { params, isLoading: true }),
  list: (params) => services.post('/product/list', { params, isLoading: true }),
  getProductCodeList: (params) => services.post('/product/get-all-product-code-list', { params }),
  getRelationProduct: (params) => services.post('/product/get-product-by-app-event', { params }),
};

// 生产管理
export const produce = {
  list: (params) => services.post('/strategy-production/list', { params, isLoading: true }),
  offfline: (params) => services.post('/strategy-production/offline', { params, isLoading: true }), // 下线
  trend: (params) => services.post('/strategy-production/trend', { params, isLoading: true }), // 走势
  detail: (params) => services.post('/strategy-production/trend', { params, isLoading: true }), // 对比详情
  revert: (params) => services.post('/strategy-production/revert', { params, isLoading: true }), // 还原
  versions: (params) => services.post('/strategy-production/versions', { params, isLoading: true }), // 历史版本
  queryOne: (params) => services.post('/strategy-production/detail', { params, isLoading: true }),
};
// 模板管理
export const template = {
  list: (params) => services.post('/strategy-template/list', { params, isLoading: true }), // 模板列表
  export: (params) => services.post('/strategy-template/export-confirm', { params, isLoading: true }), // 数据下载
  queryOne: (params) => services.post('/strategy-template/detail', { params, isLoading: true }), // 模板详情
  create: (params) => services.post('/strategy-template/create', { params, isLoading: true }), // 创建模板
  delete: (params) => services.post('/strategy-template/delete', { params, isLoading: true }), // 删除模板
  edit: (params) => services.post('/strategy-template/edit', { params, isLoading: true }), // 编辑模板
  uploadFiles: (params) => services.upload('/strategy-template/import-file', { params, isLoading: true }), // 编辑模板
  importHandle: (params) => services.post('/strategy-template/import-confirm', { params, isLoading: true }), // 编辑模板
  allTempalte: (params) => services.post('/strategy-template/all', { params }), // 获取全部模板
  templateConfirm: (params) => services.post('/strategy-template/template-data-confirm', { params, isLoading: true }), // 模板数据验证
  templateDataImport: (params) =>
    services.post('/strategy-template/template-data-import-strategy', { params, isLoading: true }), // 模板数据导入
};

//  项目管理
export const project = {
  list: (params) => servicesSmp.post('/project/page', { params }),
  listNoPage: () => servicesSmp.post('/project/list', {}),
  add: (params) => servicesSmp.post('/project/add', { params }),
  update: (params) => servicesSmp.post('/project/update', { params }),
  delete: (params) => servicesSmp.post('/project/delete', { params }),
};
